home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geni@l B1 3
/
Geni@l B1 3.iso
/
setup.exe
/
{app}
/
collector
/
utils.pyc
(
.txt
)
< prev
Wrap
Python Compiled Bytecode
|
2009-02-11
|
4KB
|
115 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.5)
from models import User
from django.conf import settings
class DummyProfile:
user = None
viewed_exercises = None
finished_exercises = None
visit = None
def get_visit(self):
pass
def set_visit(self, value):
pass
def get_viewed_exercises(self):
pass
def set_viewed_exercises(self, value):
pass
def get_finished_exercises(self):
pass
def set_finished_exercises(self, value):
pass
def get_finished_exercises_grouped(self, volume):
return { }
def get_username(self):
return ''
def save(self):
pass
if settings.IS_SBX:
def get_pupil_profile(request):
effective_username_field = u'_'.join([
request.ProjectName,
'sbx_id'])
if effective_username_field not in request.session:
return DummyProfile()
user = User.objects.get(sbxid = request.session[effective_username_field], project = request.ProjectName)
return request.ProjectSettings.UserProfile.objects.get(user = user)
def login_pupil(request, username):
(user, created) = User.objects.get_or_create(sbxid = username, project = request.ProjectName)
if created:
user.save()
profile = request.ProjectSettings.UserProfile(user = user)
profile.save()
return True
def set_sbx_username(request, username):
effective_username_field = u'_'.join([
request.ProjectName,
'sbx_id'])
if effective_username_field not in request.session:
return None
user = User.objects.get(sbxid = request.session[effective_username_field], project = request.ProjectName)
user.username = username
user.save()
else:
def get_pupil_profile(request):
effective_username_field = u'_'.join([
request.ProjectName,
'user_name'])
if effective_username_field not in request.session or request.session[effective_username_field] == 'USER':
return DummyProfile()
user = User.objects.get(username = request.session[effective_username_field], project = request.ProjectName)
return request.ProjectSettings.UserProfile.objects.get(user = user)
def login_pupil(request, username):
(user, created) = User.objects.get_or_create(username = username, project = request.ProjectName)
if created:
user.save()
profile = request.ProjectSettings.UserProfile(user = user)
profile.save()
return True
def remove_pupil(request, username):
try:
user = User.objects.get(username = username, project = request.ProjectName)
user.delete()
except:
pass